<template>
	<view>
		<web-view v-if="webview_url!==''" :src="webview_url" @message="handlePostMessage"></web-view>
<!--    <button @click="jump('/pages/payment')">1</button>-->
	</view>
</template>

<script>
	import * as api from '../api/methods'
	export default {
		data() {
			return {
				webview_url: api.getWebUrl()+ "#/login"  //login
				// 这个是看自己的域名是啥改成自己的
				// url:'https://static-2e226318-4272-4d4b-a093-a751dfcd7722.bspapp.com/webview_h5/pm_h5.html'
			}
		},
		onLoad: function (option) {
			if(wx.hideHomeButton){  
			    wx.hideHomeButton();  
			}  
		},
		methods: {
			  jump(url) {
				uni.navigateTo({
				  url: url
				})
			  },
			setUrl(url){
				if(url.indexOf("http") === -1){
					// url = "https://static-2e226318-4272-4d4b-a093-a751dfcd7722.bspapp.com/#"+url
					url = api.getWebUrl()+ "#"+url
				}
				// this.webview_url =  "https://hiep-test.fintechabchina.com/pm-h5/#/"
				// this.webview_url =  url //是否用浏览器查看报文
				// this.webview_url =""
				// setTimeout(function () {
				// }, 1000);
				console.log('this.url', url)
			},
			addQuery(q){ //q  a=1 ; a=1&b=2 
			
				console.log('addQuery 111 '+ this.url)
				if(this.url.indexOf("?") > -1){
					if(this.url.indexOf("=") > -1){ //如果有参数
						q = "&" +q
					}
					this.url += q
				}else{
					
					this.url += "?"+q
				}
				console.log('addQuery 222 '+ this.url)
			},
			handlePostMessage(data) {
				console.log("接收到消息：" + JSON.stringify(data.detail));
				
			}
		}
	}
</script>

<style>

</style>
